import React from 'react';
import { GithubOutlined } from '@ant-design/icons';
import { useModel } from 'umi';
import { DefaultFooter, SettingDrawer } from '@ant-design/pro-layout';
import defaultSettings from '../../../config/defaultSettings';

export default () => {
  const initialInfo = useModel ? useModel('@@initialState') : undefined;
  const { initialState, setInitialState } = initialInfo;
  const currentYear = new Date().getFullYear();
  const settingsConfig =
    initialState?.settings && Object.keys(initialState?.settings).length > 0
      ? initialState?.settings
      : defaultSettings;
  return (
    <>
      {initialState?.currentUser?.user &&  <SettingDrawer
        {...initialState?.SettingDrawer}
        settings={settingsConfig}
        onSettingChange={(settings) => {
          setInitialState({ ...initialState, settings });
        }}
      />}
      {/* <DefaultFooter
        copyright={`${currentYear}`}
        links={[
          {
            key: 'Ant Design Pro',
            title: 'Ant Design Pro',
            href: 'https://pro.ant.design',
            blankTarget: true,
          },
          {
            key: 'github',
            title: <GithubOutlined />,
            href: 'https://github.com/ant-design/ant-design-pro',
            blankTarget: true,
          },
          {
            key: 'Ant Design',
            title: 'Ant Design',
            href: 'https://ant.design',
            blankTarget: true,
          },
        ]}
      /> */}
    </>
  );
};
